﻿using System.Collections.Generic;
using Flatland.GeneticProgramming.CoreTypes;

namespace Flatland.GeneticProgramming.Selections {
    /// <summary>
    /// Selection strategies.
    /// </summary>
    public enum SelectionTechnique {
        /// <summary>
        /// Two randomly chosen genomes compete. 
        /// Automatic fitness scaling. 
        /// </summary>
        [GPTechnique(typeof(Tournament))]
        TOURNAMENT
    };

    public class Selection : ISelection {
        /// <summary>
        /// ISelection implementation
        /// </summary>
        ISelection _selection;

        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="selectionTechnique"></param>
        public Selection(SelectionTechnique selectionTechnique) {
            _selection = (ISelection)GPTechnique.GetImplementer(typeof(SelectionTechnique), (int)selectionTechnique);
        }

        /// <summary>
        /// Returns a list of Report of selected genes.
        /// </summary>
        /// <param name="reports"></param>
        /// <returns></returns>
        public List<Report> Select(List<Report> reports) {
            return _selection.Select(reports);
        }
    }
}
